//
//  RelatedCourseCell.m
//  Courses
//
//  Created by xxx on 15/1/12.
//  Copyright (c) 2015年 wtf. All rights reserved.
//

#import "RelatedCourseCell.h"

@implementation RelatedCourseCell
{
    UILabel *_lblIndex;
    UILabel *_lblCoursename;
}

const CGFloat kRelatedCourseCellHeight = 50;

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        UIView *indexBackgroudView = [[UIView alloc] initWithFrame:AutoRectMake(25, 10, kRelatedCourseCellHeight - 20, kRelatedCourseCellHeight - 20, WTFAutoLayoutTypeRaw)];
        indexBackgroudView.backgroundColor = [UIColor clearColor];
        indexBackgroudView.layer.cornerRadius = (kRelatedCourseCellHeight - 20) / 2;
        indexBackgroudView.layer.borderColor = [UIColor blackColor].CGColor;
        indexBackgroudView.layer.borderWidth = 1;
        [self.contentView addSubview:indexBackgroudView];
        
        _lblIndex = [[UILabel alloc] initWithFrame:indexBackgroudView.frame];
        _lblIndex.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:_lblIndex];
        
        _lblCoursename = [[UILabel alloc] initWithFrame:AutoRectMake(kRelatedCourseCellHeight + 20, 10, DEFAULT_WIDTH / 2, kRelatedCourseCellHeight - 20, WTFAutoLayoutTypeBar)];
        [self.contentView addSubview:_lblCoursename];
        
//        UIButton *btn
    }
    return self;
}

- (void)setIndex:(NSUInteger)index
{
    _lblIndex.text = [NSString stringWithFormat:@"%lu", index + 1];
}

- (void)setCourse:(Course *)course
{
    _lblCoursename.text = course.courseName;
}

@end
